<template>
	<div class="card-header-box1">
		<el-form :inline="true">
			<el-row>
				<el-form-item label="阶段状态:" style="width: 80%">
					<div style="color: #666">
						{{
							props.datainfo.progressColor == 'green' || props.datainfo.progressColor == ''
								? '正常'
								: props.datainfo.progressColor == 'orange' || props.datainfo.progressColor == 'red'
									? '滞后'
									: ''
						}}
					</div>
				</el-form-item>
			</el-row>
		</el-form>

		<!-- {{ props.requestParams.progressStatus }}
		{{ props.requestParams.progressStage }} -->
		<!-- //提前挂网 -->
		<div class="flex box-row-column">
			<div class="titlezi flex">
				<div class="flex-1">会前附件</div>
			</div>

			<div class="kuaibj mt20">
				<Cfupload
					v-for="value in fjcodelist"
					:key="value"
					:istable="false"
					:labeltitle="value.definitionName"
					:code="value.businessCode"
					:suffix-type="value.suffixType"
					:filelist="value.uploadedFiles"
					:ismust="value.imustUpload"
					:disabled="geteditberfore"
					@success="handleUploadSuccessbefore"
					@remove="handleFileRemovebefore"
					@validate="handleValidatebefore"
				></Cfupload>
				<div class="titlezi flex flex-align-center">
					<div class="">征求意见函填写</div>
					<div v-if="zqishow" class="color1491FF font14 ml60 cursor" @click="handedit(true)">编辑</div>
					<div v-if="zqishow1" class="color1491FF font14 ml60 cursor" @click="handedit(false)">查看</div>
				</div>
			</div>
		</div>

		<el-form v-if="huihoushow" ref="queryForm" :inline="true" :model="queryParams" :rules="rules" class="mt20">
			<el-row>
				<el-col :span="8">
					<el-form-item prop="zqyjReviewTime" label="评审时间:" style="width: 80%">
						<el-date-picker
							v-model="queryParams.zqyjReviewTime"
							type="date"
							:disabled="!geteditafter"
							value-format="YYYY-MM-DD HH:mm:ss"
							format="YYYY-MM-DD"
							style="width: 100%"
						/>
					</el-form-item>
				</el-col>
			</el-row>
		</el-form>

		<div v-if="huihoushow">
			<div class="titlezi flex">
				<div class="flex-1">征求意见会资料</div>
			</div>

			<div class="kuaibj mt20">
				<Cfupload
					v-for="value in fjcodelist1"
					:key="value"
					:istable="false"
					:labeltitle="value.definitionName"
					:code="value.businessCode"
					:suffix-type="value.suffixType"
					:filelist="value.uploadedFiles"
					:disabled="geteditafter"
					:ismust="value.imustUpload"
					@success="handleUploadSuccessafter"
					@remove="handleFileRemoveafter"
				></Cfupload>

				<Zhuanjiatable :zjtablelist="queryParams.solicitOpinionsExperts" :isedit="geteditafter" @getlist="getzjlist" />
			</div>
		</div>
		<!-- <div v-if="!getedit && Number(props.requestParams.progressStage) == 8" class="dialog-footer mt10">
			<el-button type="primary" plain @click="toReturntwo">退回</el-button>
		</div> -->

		<div class="dialog-footer mt10">
			<!-- 提前挂网的退回 总战有-->
			<el-button v-if="isshowyjgw" type="primary" plain @click="toReturnone">退回</el-button>
			<el-button v-if="isshowyjgw" type="primary" @click="Yjgwsubmint">一键挂网</el-button>

			<!-- 提前挂网的退回 -->
			<el-button v-if="backshow" type="primary" plain @click="toReturntwo">退回</el-button>
			<el-button v-if="tqgwshow" type="primary" @click="Gwsubmint">提请挂网</el-button>
			<!-- 总战有的一键挂网-->

			<el-button v-if="gyshow" type="success" @click="zancun">暂存</el-button>
			<el-button v-if="gyshow" type="primary" @click="allsubmint">提交</el-button>
		</div>
	</div>

	<hanDialog v-model:visible="hanvisible" :datainfo="props.datainfo" :ishandedit="ishandedit" @chananniu="hanhan"></hanDialog>
</template>
<script setup lang="ts">
import { ref, defineProps, watch, nextTick, onMounted, computed, reactive } from 'vue'
import { ElMessage, ElMessageBox } from 'element-plus'
import Cfupload from '@/components/cf-upload/index.vue'
import { router } from '@/router'
import { useUserStore } from '@/store/modules/user'
import {
	progressInfoApi,
	basicInfoApi,
	queryFilesSettingApi,
	updateStageAndStatusApi,
	doReturnApi,
	updateProgressApi,
	solicitationInfoApi,
	changeStageAndStatusApi
} from '@/api/bianzhi/index'
import Zhuanjiatable from './zhuanjiatable.vue'
//import { useDictionaryStore } from '@/store/modules/dictionary'
const userStore = useUserStore()
const emit = defineEmits<{ (event: 'updateData', value: ''): void }>()
const hanvisible = ref(false)
const queryParams = ref({} as any)
import hanDialog from './hanDialog.vue'
// const dictionaryStore = useDictionaryStore()
// const jdstatuslist = dictionaryStoregetDictionaryByCode('T007')
const fjcodelist = ref(null)
const fjcodelist1 = ref(null)
const datalist = ref([])
const uploadedFilesbefore = ref([])
const uploadedFilesafter = ref([])
const queryParamsyijian = ref({ standardProjectName: '', standardNumber: '', solicitOpinionsComment: '', solicitOpinionsDeadline: '' })
const props = defineProps({
	datainfo: {
		type: Object,
		default: () => ({})
	},
	requestParams: {
		type: Object,
		default: () => ({})
	}
})

const rules = reactive({
	zqyjReviewTime: [{ required: true, message: '请选择时间', trigger: 'change' }]
})
watch(
	() => props.requestParams,
	(newVal: any, oldVal: any) => {
		queryParams.value = newVal || {}
		// queryParams.value.zqyjReviewTime = props.requestParams.zqyjReviewTime
		// queryParams.value.solicitOpinionsExperts = props.requestParams.solicitOpinionsExperts
		queryFilesSettingApi({ businessStage: 'SolicitOpinions_Before' }).then(res => {
			fjcodelist.value = res.data
			nextTick(() => {
				if (props.requestParams.solicitOpinionsBeforeFileList.length > 0) {
					const aa: any = props.requestParams.solicitOpinionsBeforeFileList
					uploadedFilesbefore.value = aa //附件上传
					const result = fjcodelist.value.map(itemA => {
						const matchedItem = aa.find(itemB => itemB.remark === itemA.definitionName)
						//	console.log(matchedItem, 'matchedItem')
						if (matchedItem) {
							return { ...itemA, uploadedFiles: [matchedItem] } // 合并相同字段的数据
						}
						return itemA
					})
					fjcodelist.value = result //result赋值给 fjcodelist
				}
			})
		})

		if (Number(props.requestParams.progressStatus) >= 5) {
			queryFilesSettingApi({ businessStage: 'SolicitOpinions_After' }).then(res => {
				fjcodelist1.value = res.data
				nextTick(() => {
					//	console.log(props.requestParams.outlinePreparationFileList, '我是大纲附件们')

					if (props.requestParams.solicitOpinionsAfterFileList.length > 0) {
						const aa: any = props.requestParams.solicitOpinionsAfterFileList
						uploadedFilesafter.value = aa //附件上传
						const result1 = fjcodelist1.value.map(itemA => {
							const matchedItem = aa.find(itemB => itemB.remark === itemA.definitionName)
							//	console.log(matchedItem, 'matchedItem')
							if (matchedItem) {
								return { ...itemA, uploadedFiles: [matchedItem] } // 合并相同字段的数据
							}
							return itemA
						})
						fjcodelist1.value = result1 //result赋值给 fjcodelist
						//	console.log('fjcode', fjcodelist.value)
					}
				})
			})
		}

		solicitationInfoApi({ id: props.datainfo.id }).then(res => {
			queryParamsyijian.value.solicitOpinionsDeadline = res.data.solicitOpinionsDeadline
			queryParamsyijian.value.solicitOpinionsComment = res.data.solicitOpinionsComment
		})
	},
	{ immediate: true }
)

const hanhan = (data: any) => {
	hanvisible.value = false
	solicitationInfoApi({ id: props.datainfo.id }).then(res => {
		queryParamsyijian.value.solicitOpinionsDeadline = res.data.solicitOpinionsDeadline
		queryParamsyijian.value.solicitOpinionsComment = res.data.solicitOpinionsComment
	})
}
const getzjlist = value => {
	queryParams.value.solicitOpinionsExperts = value
}

const geteditberfore = computed(() => {
	if (userStore.user.roleCode.includes('SB')) {
		if (Number(props.requestParams.progressStage) == 7) {
			if (props.datainfo.edit == 'true' && (Number(props.requestParams.progressStatus) == 20 || Number(props.requestParams.progressStatus) < 2)) {
				return true
			} else {
				return false
			}
		} else {
			return false
		}
	} else {
		return false
	}
})

const geteditafter = computed(() => {
	if (userStore.user.roleCode.includes('SB')) {
		if (Number(props.requestParams.progressStage) == 7) {
			if (props.datainfo.edit == 'true' && (Number(props.requestParams.progressStatus) == 5 || Number(props.requestParams.progressStatus) == 21)) {
				return true
			} else {
				return false
			}
		} else {
			return false
		}
	} else {
		return false
	}
})
const getedit = computed(() => {
	if (userStore.user.roleCode.includes('ZZADMIN') || userStore.user.roleCode.includes('SHZZ') || userStore.user.roleCode.includes('SYADMIN')) {
		return false
	} else {
		if (Number(props.requestParams.progressStage) == 7) {
			if (props.datainfo.edit == 'true') {
				return true
			} else {
				return false
			}
		} else {
			if (Number(props.requestParams.progressStatus) == 20 || Number(props.requestParams.progressStatus) == 21) {
				return true
			} else {
				return false
			}
		}
	}
})

const zqishow = computed(() => {
	if (userStore.user.roleCode.includes('SB')) {
		if (Number(props.requestParams.progressStage) == 7) {
			if (props.datainfo.edit == 'true') {
				if (Number(props.requestParams.progressStatus) == 20 || Number(props.requestParams.progressStatus) == 1) {
					return true
				} else {
					return false
				}
			} else {
				return false
			}
		} else {
			return false
		}
	} else {
		return false
	}
})

const zqishow1 = computed(() => {
	if (Number(props.requestParams.progressStatus) >= 2 && Number(props.requestParams.progressStatus) != 20) {
		return true
	} else {
		if (userStore.user.roleCode.includes('ZZADMIN') || userStore.user.roleCode.includes('SHZZ') || userStore.user.roleCode.includes('SYADMIN')) {
			if (Number(props.requestParams.progressStatus) == 20) {
				return true
			} else {
				return false
			}
		} else {
			return false
		}
	}
})

const huihoushow = computed(() => {
	if (userStore.user.roleCode.includes('ZZADMIN') || userStore.user.roleCode.includes('SHZZ') || userStore.user.roleCode.includes('SYADMIN')) {
		if (Number(props.requestParams.progressStatus) >= 6 && Number(props.requestParams.progressStatus) != 20) {
			return true
		} else {
			return false
		}
	} else {
		if (Number(props.requestParams.progressStatus) >= 5 && Number(props.requestParams.progressStatus) != 20) {
			return true
		} else {
			return false
		}
	}
})
// ||
const backshow = computed(() => {
	if (props.datainfo.edit == 'true') {
		if (
			userStore.user.roleCode.includes('ZZADMIN') ||
			userStore.user.roleCode.includes('SHZZ') ||
			userStore.user.roleCode.includes('SYADMIN') ||
			userStore.user.roleCode.includes('SB')
		) {
			if (Number(props.requestParams.progressStage) == 8 && Number(props.requestParams.progressStatus) == 6) {
				return true
			} else {
				return false
			}
		} else {
			return false
		}
	} else {
		return false
	}
})
const tqgwshow = computed(() => {
	if (userStore.user.roleCode.includes('SB')) {
		if (props.datainfo.isshen == 'true' || props.datainfo.isshen) {
			return false
		} else {
			if (props.datainfo.edit == 'true') {
				if (Number(props.requestParams.progressStatus) == 20 || Number(props.requestParams.progressStatus) == 1) {
					return true
				} else {
					return false
				}
			} else {
				return false
			}
		}
	} else {
		return false
	}
})

const isshowyjgw = computed(() => {
	if (userStore.user.roleCode.includes('ZZADMIN') || userStore.user.roleCode.includes('SHZZ') || userStore.user.roleCode.includes('SYADMIN')) {
		if (props.datainfo.edit == 'true') {
			if (Number(props.requestParams.progressStatus) == 2 || Number(props.requestParams.progressStatus) == 21) {
				return true
			} else {
				return false
			}
		} else {
			return false
		}
	} else {
		return false
	}
})

const gyshow = computed(() => {
	if (userStore.user.roleCode.includes('SB')) {
		if (Number(props.requestParams.progressStatus) == 5 && props.datainfo.edit === 'true') {
			return true
		} else {
			return false
		}
	} else {
		return false
	}
})
const isshow = computed(() => {
	if (Number(props.requestParams.progressStatus) >= 5) {
		if (Number(props.requestParams.progressStatus) == 20 || Number(props.requestParams.progressStatus) == 21) {
			return false
		} else {
			return true
		}
	} else {
		return false
	}
})

const ishandedit = ref(true)
const handedit = row => {
	hanvisible.value = true
	ishandedit.value = row
}
// 提交时全局验证
const submit = () => {
	if (!validateBeforeSubmit(fjcodelist.value, uploadedFilesbefore.value)) {
		return
	}
	console.log('提交成功')
}

const validateBeforeSubmit = (requiredItems, uploadedFiles) => {
	const errors = []

	requiredItems.forEach(item => {
		const uploadedItem = uploadedFiles.some(file => file.remark === item.definitionName)
		if (!uploadedItem && item.imustUpload === 1) {
			errors.push(`【${item.definitionName}】未上传文件`)
		}
	})

	if (errors.length > 0) {
		ElMessage.error(errors.join(','))
		return false
	}

	return true
}

onMounted(() => {
	//	console.log(props.requestParams.solicitOpinionsBeforeFileList, '我是征求意见的附件')
})

// 处理上传成功事件
const handleUploadSuccessbefore = (data: any) => {
	uploadedFilesbefore.value.push(data) // 将接口返回的数据添加到文件列表
}

// 处理文件删除事件
const handleFileRemovebefore = (file: any) => {
	const id = file.response ? file.response.data.id : file.id
	uploadedFilesbefore.value = uploadedFilesbefore.value.filter(
		item => item.id !== id // 根据 uid 删除对应文件
	)

	//console.log(uploadedFilesbefore.value, '处理文件删除事件')
}

// 处理上传成功事件
const handleUploadSuccessafter = (data: any) => {
	uploadedFilesafter.value.push(data) // 将接口返回的数据添加到文件列表
}

// 处理文件删除事件
const handleFileRemoveafter = (file: any) => {
	const id = file.response ? file.response.data.id : file.id
	uploadedFilesafter.value = uploadedFilesafter.value.filter(
		item => item.id !== id // 根据 uid 删除对应文件
	)
}

// 存储所有上传状态
const uploadStatusbefore = ref({})
const globalErrorberfore = ref(false)
const uploadStatusafter = ref({})
const globalErrorafter = ref(false)
// 处理子组件验证事件
const handleValidatebefore = ({ isValid, title }) => {
	const index = uploadedFilesbefore.value.findIndex(item => item.title === title)
	if (index !== -1) {
		uploadStatusbefore.value[index] = isValid
	}
}
const newadditem = () => {
	const list: any = {
		expertName: '',
		expertTitle: '',
		expertCompany: '',
		expertTel: ''
	}
	datalist.value.push(list)
}

const Gwsubmint = () => {
	if (!validateBeforeSubmit(fjcodelist.value, uploadedFilesbefore.value)) {
		return
	}

	if (!queryParamsyijian.value.solicitOpinionsDeadline && !queryParamsyijian.value.solicitOpinionsComment) {
		ElMessage.error('请填写完整意见')
		return false
	}
	ElMessageBox.confirm('是否确认提请挂网', '确认', {
		confirmButtonText: '确定',
		cancelButtonText: '取消',
		type: 'warning'
	})
		.then(() => {
			Emittion('SolicitOpinions_Before', 2)
		})
		.catch(() => {})
	// const experlist = props.requestParams.solicitOpinionsExperts.map((it: any) => ({
	// 	expertName: it.expertName,
	// 	expertTitle: it.expertTitle,
	// 	expertCompany: it.expertCompany,
	// 	expertTel: it.expertTel,
	// 	id: it.id ? it.id : ''
	// }))

	// if (uploadedFilesbefore.value.length > 0) {
	// 	uploadedFilesbefore.value.forEach(item => {
	// 		delete item.name
	// 	})
	// }
	// const filelist = [...uploadedFilesbefore.value]

	// const data = {
	// 	expertsList: experlist,
	// 	id: props.requestParams.id,
	// 	standardProjectName: props.requestParams.name,
	// 	standardNumber: props.requestParams.standardNumber,
	// 	dgbzReviewTime: props.requestParams.dgbzReviewTime, //大纲评审时间  //大纲评审时间
	// 	zqyjReviewTime: props.requestParams.zqyjReviewTime, //征求意见评审时间
	// 	songsReviewTime: props.requestParams.songsReviewTime, //送审评审时间
	// 	baopCompletionTime: props.requestParams.baopCompletionTime, //报批时间
	// 	releaseTime: props.requestParams.releaseTime, //发布时间
	// 	implementationTime: props.requestParams.implementationTime, //实施时间
	// 	progressCode: 'SolicitOpinions_Before',
	// 	progressStatus: 2,
	// 	routeName: '/progressInfo',
	// 	filesRecordList: filelist , //所有附件
	// 	mainUnitList: [], //主编单位
	// 	partUnitList: [], //参编单位
	// 	projectMainDrafterList: [] //主要起草人员
	// }

	// console.log(data, 'sgsgsgsgsgsg')

	// updateStageAndStatusApi(data).then(res => {
	// 	emit('updateData', '')
	// 	ElMessage.success('保存成功')
	// })
}

const godoReturn = (type: string, code: number) => {
	//	const experlist = props.requestParams.solicitOpinionsExperts.map((it: any) => ({
	const data = {
		progressCode: type,
		id: props.requestParams.id,
		progressStatus: code
	}
	doReturnApi(data).then(res => {
		emit('updateData', '')
		ElMessage.success('退回成功')
		// nextTick(() => {
		// 	router.push({
		// 		path: '/bianzhi/shenbao/index'
		// 	})
		// })
	})
}

const toReturnone = () => {
	ElMessageBox.confirm('是否确认退回', '确认退回', {
		confirmButtonText: '确定',
		cancelButtonText: '取消',
		type: 'warning'
	})
		.then(() => {
			godoReturn('SolicitOpinions_Before', 20)
		})
		.catch(() => {})
}

const Yjgwsubmint = () => {
	if (!validateBeforeSubmit(fjcodelist.value, uploadedFilesbefore.value)) {
		return
	}

	ElMessageBox.confirm('是否确认一键挂网', '确认', {
		confirmButtonText: '确定',
		cancelButtonText: '取消',
		type: 'warning'
	})
		.then(() => {
			Emittion('SolicitOpinions_After', 5)
		})
		.catch(() => {})
	// const experlist = props.requestParams.solicitOpinionsExperts.map((it: any) => ({
	// 	expertName: it.expertName,
	// 	expertTitle: it.expertTitle,
	// 	expertCompany: it.expertCompany,
	// 	expertTel: it.expertTel,
	// 	id: it.id ? it.id : ''
	// }))

	// if (uploadedFilesbefore.value.length > 0) {
	// 	uploadedFilesbefore.value.forEach(item => {
	// 		delete item.name
	// 	})
	// }
	// const filelist = [...uploadedFilesbefore.value]

	// const data = {
	// 	expertsList: experlist,
	// 	id: props.requestParams.id,
	// 	standardProjectName: props.requestParams.name,
	// 	standardNumber: props.requestParams.standardNumber,
	// 	dgbzReviewTime: props.requestParams.dgbzReviewTime, //大纲评审时间  //大纲评审时间
	// 	zqyjReviewTime: props.requestParams.zqyjReviewTime, //征求意见评审时间
	// 	songsReviewTime: props.requestParams.songsReviewTime, //送审评审时间
	// 	baopCompletionTime: props.requestParams.baopCompletionTime, //报批时间
	// 	releaseTime: props.requestParams.releaseTime, //发布时间
	// 	implementationTime: props.requestParams.implementationTime, //实施时间
	// 	progressCode: 'SolicitOpinions_After',
	// 	progressStatus: 5,
	// 	routeName: '/progressInfo',
	// 	filesRecordList: filelist, //所有附件
	// 	mainUnitList: [], //主编单位
	// 	partUnitList: [], //参编单位
	// 	projectMainDrafterList: [] //主要起草人员
	// }

	// console.log(data, 'sgsgsgsgsgsg')

	// updateStageAndStatusApi(data).then(res => {
	// 	emit('updateData', '')
	// 	ElMessage.success('保存成功')
	//})
}

const Emittion = (type: string, code: number) => {
	const experlist = queryParams.value.solicitOpinionsExperts.map((it: any) => ({
		expertName: it.expertName,
		expertTitle: it.expertTitle,
		expertCompany: it.expertCompany,
		expertTel: it.expertTel,
		id: it.id ? it.id : ''
	}))

	if (uploadedFilesbefore.value.length > 0) {
		uploadedFilesbefore.value.forEach(item => {
			delete item.name
		})
	}
	const filelist = [...uploadedFilesbefore.value]

	const data = {
		expertsList: experlist,
		id: props.requestParams.id,
		standardProjectName: props.requestParams.name,
		standardNumber: props.requestParams.standardNumber,
		dgbzReviewTime: props.requestParams.dgbzReviewTime, //大纲评审时间  //大纲评审时间
		zqyjReviewTime: queryParams.value.zqyjReviewTime, //征求意见评审时间
		songsReviewTime: props.requestParams.songsReviewTime, //送审评审时间
		baopCompletionTime: props.requestParams.baopCompletionTime, //报批时间
		releaseTime: props.requestParams.releaseTime, //发布时间
		implementationTime: props.requestParams.implementationTime, //实施时间
		progressCode: type,
		progressStatus: code,
		routeName: '/progressInfo',
		filesRecordList: filelist, //所有附件
		mainUnitList: [], //主编单位
		partUnitList: [], //参编单位
		projectMainDrafterList: [] //主要起草人员
	}

	updateStageAndStatusApi(data).then(res => {
		emit('updateData', '')
		ElMessage.success('保存成功')
		// nextTick(() => {
		// 	router.push({
		// 		path: '/bianzhi/shenbao/index'
		// 	})
		// })
	})
}
const queryForm = ref(null)
const allsubmint = () => {
	if (!validateBeforeSubmit(fjcodelist.value, uploadedFilesbefore.value)) {
		return
	}
	if (!validateBeforeSubmit(fjcodelist1.value, uploadedFilesafter.value)) {
		return
	}

	if (queryParams.value.solicitOpinionsExperts.length == 0) {
		ElMessage.error('请至少添加一条专家信息')
		return false
	}
	queryForm.value.validate(valid => {
		if (valid) {
			ElMessageBox.confirm('是否确认提交', '确认', {
				confirmButtonText: '确定',
				cancelButtonText: '取消',
				type: 'warning'
			})
				.then(() => {
					Emittion2('SubmitApproval_Before', 6)
				})
				.catch(() => {})
		} else {
			console.log('error submit!!')
			return false
		}
	})
}

const toReturntwo = () => {
	ElMessageBox.confirm('是否确认退回', '确认退回', {
		confirmButtonText: '确定',
		cancelButtonText: '取消',
		type: 'warning'
	})
		.then(() => {
			//	godoReturn('SolicitOpinions_Before', 21)

			const data = {
				id: props.requestParams.id,
				progressStage: 7,
				progressStatus: 5
			}
			changeStageAndStatusApi(data).then(res => {
				emit('updateData', '')
				ElMessage.success('退回成功')
			})
		})
		.catch(() => {})
}

const Emittion2 = (type: string, code: number) => {
	const experlist = queryParams.value.solicitOpinionsExperts.map((it: any) => ({
		expertName: it.expertName,
		expertTitle: it.expertTitle,
		expertCompany: it.expertCompany,
		expertTel: it.expertTel,
		id: it.id ? it.id : ''
	}))
	if (uploadedFilesafter.value.length > 0) {
		uploadedFilesafter.value.forEach(item => {
			delete item.name
		})
	}
	if (uploadedFilesbefore.value.length > 0) {
		uploadedFilesbefore.value.forEach(item => {
			delete item.name
		})
	}
	const filelist = [...uploadedFilesbefore.value, ...uploadedFilesafter.value]

	const data = {
		expertsList: experlist,
		id: props.requestParams.id,
		standardProjectName: props.requestParams.name,
		standardNumber: props.requestParams.standardNumber,
		dgbzReviewTime: props.requestParams.dgbzReviewTime, //大纲评审时间  //大纲评审时间
		zqyjReviewTime: queryParams.value.zqyjReviewTime, //征求意见评审时间
		songsReviewTime: props.requestParams.songsReviewTime, //送审评审时间
		baopCompletionTime: props.requestParams.baopCompletionTime, //报批时间
		releaseTime: props.requestParams.releaseTime, //发布时间
		implementationTime: props.requestParams.implementationTime, //实施时间
		progressCode: type,
		progressStatus: code,
		routeName: '/progressInfo',
		filesRecordList: filelist, //所有附件
		mainUnitList: [], //主编单位
		partUnitList: [], //参编单位
		projectMainDrafterList: [] //主要起草人员
	}

	///	console.log(data, 'sgsgsgsgsgsg')

	updateStageAndStatusApi(data).then(res => {
		emit('updateData', '')
		ElMessage.success('提交成功')
		// nextTick(() => {
		// 	router.push({
		// 		path: '/bianzhi/shenbao/index'
		// 	})
		// })
	})
}

const zancun = () => {
	const experlist = queryParams.value.solicitOpinionsExperts.map((it: any) => ({
		expertName: it.expertName,
		expertTitle: it.expertTitle,
		expertCompany: it.expertCompany,
		expertTel: it.expertTel,
		id: it.id ? it.id : ''
	}))
	if (uploadedFilesafter.value.length > 0) {
		uploadedFilesafter.value.forEach(item => {
			delete item.name
		})
	}
	if (uploadedFilesbefore.value.length > 0) {
		uploadedFilesbefore.value.forEach(item => {
			delete item.name
		})
	}
	const filelist = [...uploadedFilesbefore.value, ...uploadedFilesafter.value]

	const data = {
		expertsList: experlist,
		id: props.requestParams.id,
		standardProjectName: props.requestParams.name,
		standardNumber: props.requestParams.standardNumber,
		dgbzReviewTime: props.requestParams.dgbzReviewTime, //大纲评审时间  //大纲评审时间
		zqyjReviewTime: queryParams.value.zqyjReviewTime, //征求意见评审时间
		songsReviewTime: props.requestParams.songsReviewTime, //送审评审时间
		baopCompletionTime: props.requestParams.baopCompletionTime, //报批时间
		releaseTime: props.requestParams.releaseTime, //发布时间
		implementationTime: props.requestParams.implementationTime, //实施时间
		progressCode: 'SolicitOpinions_After',

		routeName: '/progressInfo',
		filesRecordList: filelist, //所有附件
		mainUnitList: [], //主编单位
		partUnitList: [], //参编单位
		projectMainDrafterList: [] //主要起草人员
	}

	updateProgressApi(data).then(res => {
		ElMessage.success('暂存成功')
		emit('updateData', '')
		// nextTick(() => {
		// 	router.push({
		// 		path: '/bianzhi/shenbao/index'
		// 	})
		// })
	})
}
</script>

<style lang="scss" scoped>
.card-header-box1 {
	display: flex;

	flex-direction: column;

	overflow-y: scroll;
	height: 100%;

	&::-webkit-scrollbar {
		display: none;
	}

	.titlezi {
		font-size: 16px;
		color: #333;
	}

	.kuaibj {
		background-color: #f5f6fa;
		padding: 20px;
		border-radius: 6px;
	}

	.fjsmzi {
		font-size: 12px;
		color: #606266;
		margin-left: 5px;
	}
}
</style>
